javascript find file extension from string

72

javascript find file extension from string -

var ext =  fileName.split('.').pop();

how to get the extension from filename using javascript -

var ext = fileName.substr(fileName.lastIndexOf('.') + 1);

Comments

Submit
0 Comments